//
//  LLFocusListTableViewCell.m
//  LoveLove
//
//  Created by 达迩科技 on 2019/4/9.
//  Copyright © 2019 wkf. All rights reserved.
//

#import "LLFocusListTableViewCell.h"

@implementation LLFocusListTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initView];
    }
    return self;
}

- (void)initView{
    self.headImage = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, 36, 36)];
    self.headImage.image = [UIImage imageNamed:@"椭圆 1596"];
    self.headImage.layer.masksToBounds = YES;
    self.headImage.contentMode = UIViewContentModeScaleAspectFill;
    self.headImage.layer.cornerRadius = 18;
    [self.contentView addSubview:self.headImage];
    
    self.nameLabel = [LLInitBaseViewTool labelWithText:@"谁谁谁" textColor:LLColorRGB(49) font:18 textAlignment:NSTextAlignmentLeft];
    self.nameLabel.frame = CGRectMake(61, 14, LLScreenWidth-61-120, 18);
    [self.contentView addSubview:self.nameLabel];
    
    self.focusButton = [LLInitBaseViewTool buttonWithTitle:@"互相关注" image:@"arrows_133.09960159363px_1222146_easyicon.net" titleColor:LLColor(230, 0, 0) font:13];
    self.focusButton.frame = CGRectMake(LLScreenWidth-115, 8, 100, 30);
    [self.focusButton setBackgroundColor:LLColor(221, 224, 227)];
    self.focusButton.layer.masksToBounds = YES;
    self.focusButton.layer.cornerRadius = 15;
    [self.focusButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 5, 0,0)];
    [self.contentView addSubview:self.focusButton];
    
}
-(void)configFocusCell:(NSDictionary *)dic andType:(NSInteger)type{
    self.nameLabel.text = dic[@"user_name"];
    if ([dic[@"is_follow"] integerValue] == 1) {
        [self.focusButton setTitle:@"互相关注" forState:UIControlStateNormal];
    }else{
        if (type == 0) {
            [self.focusButton setTitle:@"关注你的" forState:UIControlStateNormal];
        }else{
            [self.focusButton setTitle:@"已关注" forState:UIControlStateNormal];
        }
        
    }
      [self.headImage sd_setImageWithURL:LLImageWithUrl(dic[@"user_avatar"]) placeholderImage:[UIImage imageNamed:@"placeholder"] options:SDWebImageRefreshCached];
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
